package com.chentf.struts2.service;

import com.chentf.entity.User;
import com.chentf.dao.UserDAO;

/**
 * @author chentengfei
 * @desc ...
 * @date 2020-12-26 16:04:57
 */
public class UserServiceImpl implements UserService {

    //传统方式,直接new接口实现类对象,耦合度较高
//    private UserDAO userDAO = new UserDAOImpl();

    public UserDAO userDAO;

    public UserDAO getUserDAO() {
        return userDAO;
    }

    public void setUserDAO(UserDAO userDAO) {
        this.userDAO = userDAO;
    }

    @Override
    public void register(User user) {
        userDAO.save(user);
    }

    @Override
    public void login(String name, String password) {
        userDAO.queryUserByNameAndPassWord(name, password);
    }
}
